/*
* bind Redux
*
* */

import React, { Component } from 'react';
import {
    AppRegistry,
    StyleSheet,
    Text,
    View
} from 'react-native';

import { createStore,combineReducers,applyMiddleware } from 'redux'
import { Provider } from 'react-redux'
import thunk from 'redux-thunk';

import * as reducers from './Src/ReduxFile/Reducer';
import AppRouter from './AppRouter'

//apply thunk
const createStoreWithThunk = applyMiddleware(thunk)(createStore);
const reducer = combineReducers(reducers);
const store = createStoreWithThunk(reducer);


export default class RNProjBaseConfig extends Component {
    //react redux组件Provider 让所有容器组件都可以访问 store，而不必显示地传递它。只需要在渲染根组件时使用即可
    render() {
        return (
            <Provider store={store}>
                <AppRouter />
            </Provider>
        );
    }
}
